<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 分类栏目管理
 */
namespace app\allwin\validate;
use think\Validate;

class Gift extends Validate{

    protected $rule = [
        'id'                => 'require|number',
        'member_miniapp_id' => 'require|number',
        'pay_num'           => 'require|number',
        'pay_amount'        => 'require|float',
        'types'             => 'require|number|between:0,1',
        'coupon_id'         => 'require|number|>:0',
        'title'             => 'require',
        'share_img'         => 'require',
        'share_title'       => 'require',
        'share_text'        => 'require',
        'note'              => 'require',
        'start_time'        => 'require|dateFormat: Y-m-d H: i: s',
        'end_time'          => 'require|dateFormat: Y-m-d H: i: s',
    ];

    protected $message = [
        'id'                => '未找到活动内容',
        'member_miniapp_id' => '应用管理出错,请重新切换管理',
        'pay_num'           => '买单次数必须填写',
        'pay_amount'        => '付款额度必须填写',
        'types'             => '赠送对象必须选择',
        'coupon_id'         => '赠送优惠券必须填写',
        'title.require'     => '活动名称必须填写',
        'title'             => '活动名称不能超过10个字符',
        'share_img'         => '分享默认图片没有上传',
        'share_title'       => '分享标题必须填写',
        'share_text'        => '分享内容必须填写',
        'note'              => '活动须知必须填写',
        'start_time'        => '活动开始时间必须填写,且规则必须是 2020-01-02 00:00:00',
        'end_time'          => '活动结束时间必须填写,且规则必须是 2020-01-02 00:00:00',
    ];

    protected $scene = [
        'add'   => ['member_miniapp_id','pay_num','pay_amount','types','coupon_id','title','share_img','share_title','share_text' ,'note','start_time' ,'end_time'],
        'edit'  => ['id','member_miniapp_id','pay_num','pay_amount','types','coupon_id','title','share_img','share_title','share_text' ,'note','start_time' ,'end_time'],
    ];
}    